<include file="../header" />
<body class="J_scroll_fixed">
    <script>

        $(document).ready(function() {

            $('a.member').click(function () {

                var id = $(this).attr("groupId");

                layer.open({

                    type: 2,
                    title: '团员列表',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['90%', '85%'],
                    content: "{:U('product/member')}&id="+id

                });
            });

            $('button.createGroup').click(function () {

                var id = "{$roundId}";

                layer.open({

                    type: 2,
                    title: '创建新团',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['90%', '85%'],
                    content: "{:U('product/createGroup')}&id="+id

                });
            });

            $('a.addMember').click(function () {

                var id = $(this).attr("groupId");

                layer.open({

                    type: 2,
                    title: '添加购买',
                    maxmin: false,
                    shadeClose: true, //点击遮罩关闭层
                    area: ['90%', '85%'],
                    content: "{:U('product/addMember')}&id="+id

                });
            });

            $("a.randAdd").click(function() {

                var id = $(this).attr("groupId");
                var number = window.prompt("请输入数量","5");

                if(number >= 0) {
                    window.location.href = "/robot/product/randAdd/id/"
                            + id + "/number/" + number;
                } else {
                    alert("请输入数字");
                    return false;
                }

            });

        });


    </script>
    <form class="well form-search" method="post" style="float:left;width:100%;" action="{:U('product/detail')}">
        <input type="hidden" name="id" value="{$roundId}" />
        <div class="search_type cc mb10">
            <div class="mb10">
        <span class="mr20">
            团长昵称：<input type="text" name="nickname" value="{$nickname}" />
            <button class="btn btn-primary" type="submit">搜索</button>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="btn btn-danger createGroup" type="button">创建新团</button>
        </span>
            </div>
        </div>
    </form>
<div class="wrap J_check_wrap">
    <table class="table table-hover table-bordered">
        <thead>
            <tr>
                <th>团长昵称</th>
                <th>团员人数</th>
                <th>购买份额</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
        <foreach name="list" item="vo">
            <tr>
                <td>{$vo.nickname}</td>
                <td>{$vo.member_number}</td>
                <td>{$vo.buy_number}</td>
                <td>
                    <a class="member" href='javascript:void(0)' groupId="{$vo.group_id}">团员列表</a>
                    <a class="addMember" href='javascript:void(0)' groupId="{$vo.group_id}">添加购买</a>
                    <a class="randAdd" href='javascript:void(0)' groupId="{$vo.group_id}">批量添加</a>
                </td>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page}</div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>